package org.example;

import org.example.ticket.MovieTicket;
import org.example.ticket.discount.DiscountStrategy;
import org.example.ticket.discount.StudentDiscountStratege;
import org.example.ticket.discount.VipDiscountStrategy;

import java.util.logging.Logger;

public class Main {
    public static void main(String[] args) {



        MovieTicket movieTicket= new MovieTicket();
        System.out.println("票原价:120.0");
        movieTicket.setOriginalPrice(120.0);
        //new一个上下文对象
        DiscountStrategy strategy=new StudentDiscountStratege();
        DiscountStrategy strategy2=new VipDiscountStrategy();
        System.out.println("设置打折模式:儿童票");
        movieTicket.setDiscountStrategy(strategy); //设置打折模式

        movieTicket.discountCalulate();
        System.out.println("打折后:"+movieTicket.getDiscountPrice());

        System.out.println("再次设置打折模式:VIP票");
        movieTicket.setDiscountStrategy(strategy2);  //再次设置打折模式

        movieTicket.discountCalulate();
        System.out.println("打折后:"+movieTicket.getDiscountPrice());
    }
}